Listing 5 shows how your video output component can start video output.
Listing 5 Starting video output
pascal ComponentResult MyQTVideoOutputBegin (Globals storage)
{
ComponentResult err;
long mode;
// call the default implementation
err = QTVideoOutputBegin (storage->baseVideoOutput);
if (err) goto bail;
// get the selected mode
err = QTVideoOutputGetDisplayMode (storage->self, &mode);
if (err) goto bail;
// switch the hardware to the selected mode
// remember that we now own the hardware
storage->ownHardware = true;
bail:
if ((err != noErr) && (storage->ownHardware == true))
QTVideoOutputEnd (storage-> baseVideoOutput);
return err;
}
The default implementation of the QTVideoOutputBegin function ensures that the hardware is not currently in use by other software. It also ensures that a valid display mode has been set with either the QTVideoOutputSetDisplayMode function or the QTVideoRestoreSettings function.